
/* function for doing (un)selectAll checkbox items with the same name */
function checkAll(ckb_nm, ckb_all_id) {
    var obj = document.getElementsByName(ckb_nm);
    var is_ck_all = document.getElementById(ckb_all_id).checked;
    for (var i=0; i<obj.length; i++) {
        if (obj[i].disabled) continue;
        obj[i].checked = is_ck_all;
    }
} 

/* the follow functions are for showing pop-up tip window.
   Make sure the follow line is removed from the page on
   which the pop-up tip window is applied.
   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
*/
var r;
var is_hide = true;

function div_mouseover () {
    is_hide = false;
}

function div_mouseout () {
    is_hide = true;
    hideMessage();
}

function showMessage(Idx)
{

    if (r) {
        r.style.display = 'none';
    }
    // pop-up tip window
    r = document.getElementById('div_'+Idx);
    // of whom the tip window pops up
    var l = document.getElementById('item_'+Idx);
    var t = l.offsetTop;
    var lf = l.offsetLeft;
    var p = l.offsetParent;
    while (p.tagName != 'BODY') {
        t += p.offsetTop;
        lf += p.offsetLeft;
        p = p.offsetParent;
    }
    lf += (l.offsetWidth + 10);

    var body = document.body;
    var absoluteW = body.scrollLeft + body.clientWidth;
    var absoluteH = body.scrollTop + body.clientHeight;

    // set tip window's style so that it gets attributes
    // such as offsetWidth/offsetHeight
    r.style.top = t + 'px';
    r.style.left = lf + 'px';
    r.style.display = '';
    //if (lf + r.offsetWidth > absoluteW) {
    //    lf = absoluteW - r.offsetWidth - 10;
    //}
    //if (t + r.offsetHeight > absoluteH) {
    //    t = absoluteH - r.offsetHeight;
    //}
    //r.style.top = t + 'px';
    //r.style.left = lf + 'px'; 
    //r.style.display = '';
}

function hideMessage()
{
    if (is_hide && r) {
        r.style.display = 'none';
    }
}
/* end of pop-up tip window */

